using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Common.Pool
{
    public class MonoGamePoolObj<T> : PoolObject<T> where T : MonoBehaviour
    {

        public MonoGamePoolObj(T target) : base(target)
        {

        }
        public override PoolObject<T> Clone()
        {
            var clonetarget = GameObject.Instantiate(Target.gameObject, Vector3.zero, Quaternion.identity).GetComponent<T>();
            return new MonoGamePoolObj<T>(clonetarget);
        }
        public override void OnSpawn()
        {
            Target.gameObject.SetActive(true);
            Target.transform.localScale = Vector3.one;
        }
        public override void OnRecycle()
        {
            Target.gameObject.SetActive(false);
        }
        public override void OnDestory()
        {
            GameObject.Destroy(Target.gameObject);
        }

    }
}

